// $codepro.audit.disable
package edu.gatech.oad.cyberdoc.view.container;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.json.JSONException;
import org.json.JSONObject;

import edu.gatech.oad.cyberdoc.view.AppointmentGroupsPanel;
import edu.gatech.oad.cyberdoc.view.InfoPanel;
import edu.gatech.oad.cyberdoc.view.TreatmentRecordPatientPanel;
import edu.gatech.oad.cyberdoc.view.invoice.InvoicePanel;
import edu.gatech.oad.cyberdoc.view.menu.PatientMenu;

public class PatientPanel extends ContainerPanel {

	/**
	 * This class's logger.
	 */
	private static final Logger LOG;

	static {
		LOG = Logger.getLogger("edu.gatech.oad.cyberdoc.view.PatientPanel");
	}

	/**
	 * Create the panel.
	 */
	public PatientPanel() {
		super(new PatientMenu());

		addCard("view_appts", new AppointmentGroupsPanel());
		addCard("view_treatmentRecord",new TreatmentRecordPatientPanel());
		addCard("view_info", new InfoPanel());
		addCard("view_invoices", new InvoicePanel());
		
		map("view_invoice", "view_invoices");
	}

	@Override
	public void show(JSONObject response) {
		show("default", null);

		if (response.has("action")) {
			try {
				String action = response.getString("action");

				if (!action.equals("login")) {
					if (action.equals("select_appt")) {
						textLabel.setText("Appointment reserved");
					}
				}
			} catch (JSONException e) {
				LOG.log(Level.SEVERE, "Unexpected exception", e);
			}
		}
	}
}
